import mysql.connector


# 类

class ConnectDb:

    def get_connect_db(*args):
        info = args[0]
        con = None
        try:
            con = mysql.connector.connect(
                user=info[0],
                host=info[1],
                port=info[2],
                password=info[3],
                database=info[4],
                charset='utf8'
            )
        except mysql.connector.Error as e:
            print('数据库连接失败', str(e))
        else:
            print("连接成功！")

        return con
